home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / bbs / cuser125.zip / CUCHECK2.MEX < prev    next >
Text File  |  1997-07-12  |  6KB  |  234 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //                                                                          //
  3. // CoolUser V1.25 (C)1996-1997 Neil Staib  - Checked Part 2                 //
  4. //                                                                          //
  5. // MEX: Copywrite 1990, 1995 by Lanius Corporation. All Rights reserved.    //
  6. //                                                                          //
  7. //////////////////////////////////////////////////////////////////////////////
  8. #include <max.mh>
  9. #define INCL_global
  10. #define INCL_cooluser
  11. #include <language.mh>
  12. #include <cooluser.mh>
  13. #define     MAX_LINES       250
  14.  
  15. void main()
  16. {
  17.     int: counter, count, sbname, cool, iname, eof, badtry, line;
  18.     char: nonstop,inkey;
  19.     struct _usr: newusr;
  20.     string: pwd2, password, fname, lname;
  21.     array [1..MAX_LINES] of string: badpass;
  22.     nonstop:=0;
  23.     badtry:=0;
  24.  
  25.     init_lang_cooluser();
  26.  
  27.     log(":COOLUSER: "+ str_st_log_password);
  28.  
  29.     getpassword:
  30.     pageheader();
  31.     print(str_st_header, str_st_pass_name, "\n");
  32.     print(str_st_text, "\n", str_st_pass_prompt, ": ");
  33.  
  34.     password:="";
  35.     counter:=1;
  36.  
  37.     inkey:=getch();
  38.     while(inkey<>13) // do this until we get <Enter>
  39.     {
  40.         if(inkey=8)             // if we got a <Backspace>
  41.         {
  42.             if(counter>1)
  43.             {
  44.                 print("\b \b");
  45.                 counter:=counter-1;
  46.                 password:=substr(password,1,strlen(password)-1);
  47.             }
  48.             else
  49.                 password:="";
  50.         }
  51.         else if(counter <=15)
  52.                 {
  53.                   print("*");
  54.                   password[counter]:=inkey;
  55.                   counter:=counter+1;
  56.                 }
  57.              else
  58.                 {
  59.                  password:="";
  60.                 }
  61.         inkey:=getch();
  62.     }
  63.  
  64.     if(strlen(password)=0)
  65.     {
  66.       writefile("cucheck.3");  // Display Main Menu
  67.       return;
  68.     }
  69.  
  70.     if(strlower(password) <> strlower(usr.pwd))
  71.     {
  72.       badtry:=badtry+1;
  73.       if(badtry=4)
  74.       {
  75.         print(str_st_error, "\n", str_st_pass_badtry);
  76.         sleep(200);
  77.         display_file(str_st_dir_txt + "hangup", nonstop);
  78.       }
  79.       else
  80.       {
  81.        print(str_st_error, "\n", str_st_text, str_st_pass_incorrect, "\n");
  82.        sleep(100);
  83.        goto getpassword;
  84.       }
  85.     }
  86.     print(str_st_text, "\n", str_st_pass_new, ": ");
  87.  
  88.     password:="";
  89.     counter:=1;
  90.  
  91.     inkey:=getch();
  92.     while(inkey<>13) // do this until we get <Enter>
  93.     {
  94.         if(inkey=8)             // if we got a <Backspace>
  95.         {
  96.             if(counter>1)
  97.             {
  98.                 print("\b \b");
  99.                 counter:=counter-1;
  100.                 password:=substr(password,1,strlen(password)-1);
  101.             }
  102.             else
  103.                 password:="";
  104.         }
  105.         else if(counter <=15)
  106.                 {
  107.                   print("*");
  108.                   password[counter]:=inkey;
  109.                   counter:=counter+1;
  110.                 }
  111.              else
  112.                 {
  113.                  password:="";
  114.                 }
  115.         inkey:=getch();
  116.     }
  117.  
  118.     print('\n');
  119.  
  120.     if(password="" or strfind(password," "))
  121.     {
  122.         print("\n", str_st_pass_bad,"\n\n");
  123.         goto getpassword;
  124.     }
  125.  
  126.     if((strlen(password)<4))
  127.     {
  128.        print("\n", str_st_pass_less4, "\n\n");
  129.        goto getpassword;
  130.     }
  131.  
  132.     if((strlen(password)>15))
  133.     {
  134.        print("\n", str_st_pass_more15, "\n\n");
  135.        goto getpassword;
  136.     }
  137.  
  138.     if(password = fname)
  139.     {
  140.      log(":" + str_st_log_passwordbad + password + "'");
  141.      print(str_st_error, "\n", str_st_text, str_st_pass_incorrect, "\n");
  142.       goto getpassword;
  143.     }
  144.  
  145.     if(password = lname)
  146.     {
  147.       log(":" + str_st_log_passwordbad + password + "'");
  148.       print(str_st_error, "\n", str_st_text, str_st_pass_incorrect, "\n");
  149.       goto getpassword;
  150.     }
  151.  
  152.     if(password = fname+lname)
  153.     {
  154.       log(":" + str_st_log_passwordbad + password + "'");
  155.       print(str_st_error, "\n", str_st_text, str_st_pass_incorrect, "\n");
  156.       goto getpassword;
  157.     }
  158.  
  159.     // Check Password
  160.     iname := 1;
  161.     badpass[cool]:= "";
  162.     eof:=0;
  163.     iname := open("d:\\bbs\\max\\pwdtrash.bbs", IOPEN_READ);   // Scan for Bad password
  164.  
  165.        for(cool:=1;cool<MAX_LINES;cool:=cool+1)
  166.         {
  167.           eof := readln(iname, badpass[cool]);
  168.  
  169.           if (eof = -1)
  170.           {
  171.            close(iname);
  172.            goto getpassword2;
  173.           }
  174.          else
  175.          {
  176.            if (strlower(password) = strlower(badpass[cool]))
  177.              {
  178.                log(":" + str_st_log_passwordbad + password + "'");
  179.                print(str_st_error, "\n", str_st_text, str_st_pass_incorrect, "\n");
  180.                close(iname);
  181.                goto getpassword;
  182.              }
  183.          }
  184.         }
  185.  
  186.     getpassword2:
  187.  
  188.     print(str_st_pass_ver);
  189.  
  190.     pwd2:="";
  191.     counter:=1;
  192.  
  193.     inkey:=getch();
  194.     while(inkey<>13) // do this until we get <Enter>
  195.     {
  196.         if(inkey=8)             // if we got a <Backspace>
  197.         {
  198.             if(counter>1)
  199.             {
  200.                 print("\b \b");
  201.                 counter:=counter-1;
  202.                 pwd2:=substr(pwd2,1,strlen(pwd2)-1);
  203.             }
  204.             else
  205.                 pwd2:="";
  206.         }
  207.         else if(inkey=0)        // if we got a NULL
  208.         {
  209.             inkey:=getch();
  210.         }
  211.         else
  212.         {
  213.             print("*");
  214.             pwd2[counter]:=inkey;
  215.             counter:=counter+1;
  216.         }
  217.         inkey:=getch();
  218.     }
  219.     print('\n');
  220.  
  221.     if(strlower(password)<>strlower(pwd2))
  222.     {
  223.         count:=1;
  224.  
  225.         print("\n", str_st_pass_match, "\n");
  226.  
  227.         goto getpassword;
  228.     }
  229.  
  230.    newusr.pwd:=password;
  231.    return;
  232. }
  233.  
  234.